import request from'@/request.js'



export const checkusernameservice = (username) => {
    const queryParams = new URLSearchParams();
    queryParams.append('username', username); // 将用户名添加到查询字符串中

    const url = `/user/checkuser?${queryParams.toString()}`; // 将查询字符串添加到 URL 中

    return request.post(url);
}

export const sendVerificationCodeservice = (email) => {
    const params = new URLSearchParams();
    params.append('email', email);
    return request.post('/user/sendcode', params);
}

export const submituserservice = (requstbody) => {
const params=new URLSearchParams();
    for(let key in requstbody){
        params.append(key,requstbody[key])
    }
        return request.post('/user/register',params)
    }

export const loginserice = (loginbody) => {
    const params=new URLSearchParams();
    for(let key in loginbody){
        params.append(key,loginbody[key])
    }

    return request.post('/user/login',params)
}

export const captchaservice = () => {

    return request.get('/user/captcha',{ responseType: 'blob' })
}

